Multiple-processor, multiple-threaded, and other types of multi-tasking computer systems allow more than one process to be executed at the same time. Such computer systems have certain performance benefits and advantages. Running more than one process at the same time is generally quicker than running one process until it is finished, and then running a second process until it is finished, and so on. Modern applications for computer systems indeed often require that more than one process be executed at the same time, either on the same processor, or on multiple processors.
However, multi-tasking computer systems can introduce processing complexities that are not present when only one process is being executed at a time. For example, data files within computer file systems are commonly renamed and/or moved. A potential problem occurs when while a data file is being renamed or moved by a first process, a second process attempts to access, or look up, the data file. The second process may initially be able to access the data file, but mid-way through its access of the data file, the data file is successfully renamed or moved by the first process, such that the second process is no longer able to properly access the data file.
Problems of this kind are generally prevented by guaranteeing what is referred to as atomicity of the renaming or moving process. In the context herein, the renaming or moving of a data file requires that if access to the old name or location of a data file fails, then subsequent access to the new name or location of the data file must necessarily succeed, and that if access to the new name or location of the data file succeeds, then subsequent access to the old name or location of the data file must necessarily fail. Such renaming or moving processes are therefore referred to as atomic renaming or atomic moving.
Atomicity can be provided for by the first process locking the file system and/or directories in which the data file is located, so that the second process cannot access the data file in any way until the first process completes its operations and unlocks the file system and/or directories. However, locking requires significant overhead, both on the first process that is doing the locking and unlocking, as well as on the second process that is looking up the data file. Such performance penalties are undesirable, especially when in most situations data files that are being renamed or moved by first processes will not be subject to look-ups by second processes.
A limited solution exists within version 2.6 of the kernel of the Linux operating system, which is known within the art, via its directory cache, or dcache, subsystem permitting lock-free look-ups of data files within a directory. However, this approach does not provide for atomically renaming or moving of files, and instead removes a data file's record from its old location, and then later adds a record to the new location. Therefore, to ensure atomicity, locking must nevertheless still be employed.